package com.sc.web.gwt.client.service;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.sc.web.gwt.shared.model.UserAccount;

import java.util.List;

@RemoteServiceRelativePath("UserAccountDataManagementService")
public interface UserAccountDataManagementService extends RemoteService {
    boolean changeState(int userAccountId);

    UserAccount getUserAccountData(int userAccountId);

    UserAccount createNewUserAccount();

    boolean saveOrUpdateUserAccountData(UserAccount userAccount);

    List<UserAccount> getAllUserAccounts();
    List<UserAccount> searchUserAccounts(String searchText, int searchIndex);

    /**
     * Utility/Convenience class.
     * Use UserAccountDataManagementService.App.getInstance() to access static instance of UserAccountDataManagementServiceAsync
     */
    public static class App {
        private static final UserAccountDataManagementServiceAsync ourInstance = (UserAccountDataManagementServiceAsync) GWT.create(UserAccountDataManagementService.class);

        public static UserAccountDataManagementServiceAsync getInstance() {
            return ourInstance;
        }
    }
}
